package com.yq.dao;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yq.entity.Healthregistration;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yq.entity.Healthregistrationd;
import com.yq.entity.companys;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author zxn
 * @date 2020-03-16
 * @description   Mapper 接口
 */
@Repository
@Mapper
public interface HealthregistrationDao extends BaseMapper<Healthregistration> {

    @Select("select count(*) as num,companyname as name from healthregistration group by companyname")
    List<companys> tongji();

    @Select("select h.*,c.commnuityname as communitynamed from healthregistration as h LEFT JOIN communitye as c on h.communityid = c.id ${ew.customSqlSegment}")
//    @Select("select h.*,c.commnuityname as communitynamed from healthregistration as h LEFT JOIN communitye as c on h.communityid = c.id")
    Page<Healthregistrationd> listd(@Param(Constants.WRAPPER) Wrapper wrapper, IPage page);
}
